package com.unionftech.content_login.api

import com.unionftech.common.bean.ResponseResult
import com.unionftech.common.recaptcha.RecaptchaInterceptor
import com.unionftech.common.recaptcha.RecaptchaUtil
import com.unionftech.content_login.bean.LoginTokenInfo
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.PUT

interface LoginApi {

    /**
     * 登录
     */
    @Headers(
        "Content-Type:application/json",
        "systemtype:ANDROID",
        "${RecaptchaInterceptor.KEY_INTERCEPTOR_ACTION}:${RecaptchaUtil.ACTION_LOGIN}"
    )
    @POST("auth/login")
    suspend fun login(
        @Header("uuid") uuid: String,
        @Header("model") model: String,
        @Header("version") version: String,
        @Body body: RequestBody,
    ): String


    /**
     * 三方登录(网易一键登录、Google登录)
     */
    @Headers(
        "systemtype:ANDROID"
    )
    @POST("auth/thirdlogin")
    suspend fun thirdlogin(
        @Header("uuid") uuid: String,
        @Header("model") model: String,
        @Header("version") version: String,
        @Body body: RequestBody
    ): String

    /**
     * 登出
     */
    @GET("auth/logout")
    suspend fun logout(@Header("Authorization") token: String): ResponseResult<Any?>


    /**
     * 用户修改密码
     */
    @Headers("requestSource:APP", "Content-Type:application/json")
    @PUT("system/user/password")
    suspend fun resetPassword(@Body body: RequestBody): ResponseResult<Any?>

}